/**
 * 
 */
package br.com.sistransporte.transitevo.permissao.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

import br.com.sistransporte.transite.utilidades.Constantes;
import br.com.src.masterpersistence.abstractpersistence.AbstractVO;
import br.com.src.masterpersistence.annotations.CronosFilter;

/**
 * Classe que representa
 *
 *
 * @author Nelson Luis da Silva Junior <nelson.jr13@hotmail.com@>
 * @since 3 de Jul de 2013 16:07:22
 * @version 1.0
 */
@Entity
@Table( name = "permissao", schema = Constantes.SCHEMA, uniqueConstraints = @UniqueConstraint( columnNames = { "acao", "nome_tela" } ) )
public class PermissaoVO extends AbstractVO{
	
	@Transient
	public static final Boolean ADICIONAR_ONIBUS_PERMITIDO = true;
	@Transient
	public static final Boolean ADICIONAR_ONIBUS_NEGADO = false;
	@Transient
	public static final Boolean REMOVER_ONIBUS_PERMITIDO = true;
	@Transient
	public static final Boolean REMOVER_ONIBUS_NEGADO = false;
	@Transient
	public static final Boolean ADICIONAR_USUARIOS_PERMITIDO = true;
	@Transient
	public static final Boolean ADICIONAR_USUARIOS_NEGADO = false;
	@Transient
	public static final Boolean VER_RELATORIOS_PERMITIDO = true;
	@Transient
	public static final Boolean VER_RELATORIOS_NEGADO = false;
	
	@CronosFilter
	@Column( name = "acao", nullable = true, length = 255 )
	private String acao;

	@CronosFilter
	@Column( name = "nome_tela", nullable = true, length = 255 )
	private String nomeTela;

	public PermissaoVO(){}

	public PermissaoVO( Integer id, String acao, String nomeTela ){
		super( id );
		setAcao( acao );
		setNomeTela( nomeTela );
	}

	public final String getAcao() {
		return acao;
	}

	public final void setAcao( String acao ) {
		this.acao = acao;
	}

	public final String getNomeTela() {
		return nomeTela;
	}

	public final void setNomeTela( String nomeTela ) {
		this.nomeTela = nomeTela;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ( ( acao == null ) ? 0 : acao.hashCode() );
		result = prime * result + ( ( nomeTela == null ) ? 0 : nomeTela.hashCode() );
		return result;
	}

	@Override
	public boolean equals( Object obj ) {
		if ( this == obj ) {
			return true;
		}
		if ( obj == null ) {
			return false;
		}
		if ( !( obj instanceof PermissaoVO ) ) {
			return false;
		}
		PermissaoVO other = (PermissaoVO) obj;
		if ( acao == null ) {
			if ( other.acao != null ) {
				return false;
			}
		} else if ( !acao.equals( other.acao ) ) {
			return false;
		}
		if ( nomeTela == null ) {
			if ( other.nomeTela != null ) {
				return false;
			}
		} else if ( !nomeTela.equals( other.nomeTela ) ) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "PermissaoVO [getAcao()=" + getAcao() + ", getNomeTela()=" + getNomeTela() + ", hashCode()=" + hashCode() + "]";
	}

}
